package com.couldtest.providerB.controller;

import com.couldtest.providerB.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.web.bind.annotation.*;

/**
 * Created by liguanfu on 2018/6/7.
 */
@RestController
public class DcController {


    @Autowired
    DiscoveryClient discoveryClient;

    @GetMapping("/dc")
    public String dc() {
        String services = "Services: " + discoveryClient.getServices();
        System.out.println(services);
        return services;
    }


    @GetMapping("/dcx")
    public String dcx() throws InterruptedException {
        return "provider-B";
    }


   /* @GetMapping("/dcx1")
    public String dcx1(@RequestParam("id") String id , @RequestParam("name") String name) {
        return "服务—A,dcx1，姓名："+name+"编号："+id;
    }


    @GetMapping("/dcx2")
    public String dcx2(@RequestHeader("id") String id , @RequestHeader("name") String name) {
        return "服务—A,dcx2，姓名："+name+"编号："+id;
    }*/
/*
    @GetMapping("/dcx1")
    public String dcx1( User user) {
        return "服务—B,dcx1，姓名："+user.getName()+"编号："+user.getName();
    }


    @GetMapping("/dcx2")
    public String dcx2(User user) {
        return "服务—B,dcx2，姓名："+user.getName()+"编号："+user.getName();
    }*/
}
